package chenji.yourticket.model;

import java.text.SimpleDateFormat;

import org.bukkit.inventory.ItemStack;

import chenji.yourticket.Main;
import chenji.yourticket.inventory.SimpleItemStack;

public class ModelInfo implements Comparable<ModelInfo> {
	private long createdate;
	private ItemStack Item;
	private String Name;
	private ItemStack DisplayItemStack;

	/**
	 * 
	 * @param createDate
	 * @param item
	 * @param Name
	 * @param Node
	 */
	public ModelInfo(Long createDate, ItemStack item, String Name) {

		this.createdate = createDate;
		this.Item = item;
		this.Name = Name;
	
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

	
			DisplayItemStack = new SimpleItemStack(item.getType(),
					Main.getMessageManager().getItem_DisplyModel_Lore_WithoutNode()
							.replaceAll("%time%", df.format(this.createdate)).replaceAll("%name%", this.Name),
					Main.getMessageManager().getItem_DisplyModel_Title().replaceAll("%name%", this.Name));

		
	}

	public ItemStack getDisplayItemStack() {
		return DisplayItemStack;
	}

	public Long getCreateDate() {
		return this.createdate;
	}

	public ItemStack getItem() {
		return this.Item;
	}

	public String getName() {
		return this.Name;
	}


	public void setItem(ItemStack i) {
		this.Item = i;
	}

	@Override
	public int compareTo(ModelInfo o) {
		if (this.getCreateDate() < o.getCreateDate()) {
			return -1;
		}
		return 1;
	}
}
